import { createRouter, createWebHashHistory } from 'vue-router'
const Layout = () => import('@/views/Layout')
const Home = () => import('@/views/home')
const Category = () => import('@/views/category')
const routes = [
  // 一级路由布局容器
  {
    path: '/',
    component: Layout,
    children: [
      {
        path: '/',
        component: Home
      },
      {
        path: '/category',
        component: Category
      }
    ]
  }
]

// vue 2.0 new VueRouter({})  创建路由实例
// vue 3.0 createRouter({})   创建一个路由实例
const router = createRouter({
  history: createWebHashHistory(), // 使用什么模式,使用hash的路由模式
  routes
})

export default router
